#include<map>
#include"ttfParser_Cell_ContentPointers.hpp"
#include<lcc_typedef/lcc_typedef.hpp>// unicode

template<class T_rst=uint16_t>
T_rst u8Unicode( const void* _utf8, LccToolbox::block<T_rst>* unicodeline=nullptr, size_t remainedCount=0);


namespace LccStuffCollector{
namespace TTFParser{




typedef LccToolbox::block<unicode> unicodes;

typedef uint32_t glyphIndex;// for get offset of the glyfItem
typedef LccToolbox::block<glyphIndex> glyphIndexes;

// ttfParser's job:
//	* cover the content of a ttf file for program reading
//	* parse the glyph drawing data for program reading
class ttfParser{
	const uint16_t platformID;
	const uint16_t platformSpecificID;
	const uint16_t format;
	ttfReader reader;
	bool canuse=false;
public:
	TTFPARSER_API ttfParser( uint16_t platformID=0, uint16_t platformSpecificID=3, uint16_t format=4);
	TTFPARSER_API void cover(char* ttfcontent);
	const ttfReader& cReader(){return reader;}// const-reader

	// below is for unicode quicker finding & extracting the covered data into program readable data
private:
	std::map<unicode,glyphIndex> U2GI;// unicode to glyphIndex
	std::map<glyphIndex,size_t> GI2RI;// glyphIndex to parsed result(recorded in glyfItems) index// for faster & avoid re-form glyph
public:
	const volatile LccToolbox::block<glyfItem> glyfItems;// to record the parsed glyphItem result
	TTFPARSER_API void getGlyphIndex(const unicodes&,glyphIndexes&);// convert the unicode to glyphIndex which record the core offset of glyfItem
	TTFPARSER_API void parse(const glyphIndexes&,LccToolbox::block<size_t>&);// parse the indexing glyph & convert the glyphIndex to local parsed result index
};




}// namespace TTFParser
}// namespace LccStuffCollector

#include"inl/ttfParser.inl"


// [ left question ]
// is diff class's func's static is diff?